import config from 'config'
import httpFetch from "share/httpFetch"

export default {
  //获取单据查看列表
  getFinanceViewList(page, size,searchParams, isAudit) {
    return httpFetch.post(`${config.baseUrl}/api/approvals/filters/get?size=${size}&page=${page}${isAudit && `&isAudit=1`}`,searchParams);
  },

  //获取表单类型
  //1001借款单，1002报销单，不传查全部
  getFormType(type){
    return httpFetch.get(`${config.baseUrl}/api/custom/forms/finance/all?formType=${type}`)
  },

  //导出单据列表
  exportFinanceList(searchParams) {
    let url = `${config.baseUrl}/api/reimbursement/batch/detail/export/expensReportOrApplication`;
    return httpFetch.post(url, searchParams, {}, {responseType: 'arraybuffer'});
  },

  printExpenseReport(expenseReportOID){
    return httpFetch.get(`${config.baseUrl}/api/expense/reports/generate/pdf/${expenseReportOID}`);
  }

}
